package com.example.pro3_reactor;

import reactor.core.publisher.Flux;
import reactor.core.scheduler.Schedulers;

import java.io.IOException;

/**
 * @program: reactivePro
 * @description: 并行
 * @author: zy
 * @create: 2025-04-26 21:14
 */
public class App6_parallel {
    public static void main(String[] args) throws IOException {
        Flux.range(1, 10)
                .parallel(5)   // 并行处理
                .runOn(Schedulers.parallel())  // 指定并行处理的线程池
                .subscribe(i -> System.out.println(Thread.currentThread().getName() + " -> " + i));

        System.in.read();
    }
}
